package cn.regexp.canal.enums;

import lombok.Getter;

import java.util.concurrent.TimeUnit;

/**
 * @author Regexpei
 * @date 2024/7/5 23:33
 * @description 秒杀Redis Key枚举
 */
@Getter
public enum SeckillRedisKeyEnum {


    SECKILL_ORDER_HASH("seckillOrderHash:");

    private final String prefix;
    private TimeUnit unit;
    private int expireTime;

    SeckillRedisKeyEnum(String prefix, TimeUnit unit, int expireTime) {
        this.prefix = prefix;
        this.unit = unit;
        this.expireTime = expireTime;
    }

    SeckillRedisKeyEnum(String prefix) {
        this.prefix = prefix;
    }

    public String getRealKey(String key) {
        return this.prefix + key;
    }


}